package com.kylin.androidlearn1.acticity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.kylin.androidlearn1.R;
import com.kylin.androidlearn1.Uitls.SMSUtils;

public class ActivitySMS extends Activity implements View.OnClickListener {

    private Button btSend;
    private EditText mETSmsContent;
    private EditText mETPhoneNumber;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sms);

        btSend = (Button) findViewById(R.id.bt_send) ;

        mETSmsContent = (EditText) findViewById(R.id.et_sms_content) ;
        mETPhoneNumber = (EditText) findViewById(R.id.et_phone_number) ;

//        //onclick 方式一
//        btSend.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//            }
//        });

//        //onclick 方式二
        btSend.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_send:
                //1 获取 手机号
                String phoneNumber =   mETPhoneNumber.getText().toString();
//                2 获取短信内容
                String smsContent =   mETSmsContent.getText().toString();
//                3 发送短信
//                SMSUtils.sendSMS(phoneNumber,smsContent);
                SMSUtils.JumpSendSMS(this,phoneNumber,smsContent);
                break;
        }

    }


//    public void send(View v) {
//        Toast.makeText(this,"show",Toast.LENGTH_LONG).show();
//    }

}
